package Deom;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2023-11-12
 * Time: 22:31
 */
public class Test {
    //以Shape类型为参数向上转型
    /*public static void func(Shape shape) {
       shape.draw();
    }*/
    public static void main(String[] args) {
//      func(new Cycle());
//      func(new Flower());
//      func(new Rect());
//      func(new Triangle());
        Shape cycle = new Cycle();
        Shape flower = new Flower();
        Shape rect = new Rect();
        Shape triangle = new Triangle();
        Shape[] shapes = {cycle,flower,rect,triangle};
        for(Shape shape:shapes) {
            shape.draw();
        }
    }
}
